#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPaintEvent>
#include <QPainter>
#include <QPen>
#include <QDebug>
#include <QTimer>
#include <QPoint>
#include <QRotationSensor>
#include <QTcpServer>
#include <QTcpSocket>
#include <QHostAddress>
#include <QNetworkInterface>
#include <QCursor>
#include <vector>
#include <iostream>
using namespace std;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();


    void send_str(char sendBuf[]);

    QTimer *m_timer;
    QRotationSensor *rotationSensor;
    QRotationReading *rotationReading;

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void update_text();

    void paintEvent(QPaintEvent *);

    void on_car_clicked();

    void on_left_pressed();

    void on_left_released();

    void on_right_pressed();

    void on_right_released();

private:
    Ui::MainWindow *ui;
    bool startSend;
    bool isConnect;
    bool mode;
    QTcpServer  *tcpServer;//监听套接字
    QTcpSocket  *tcpSocket;//通信套接字

    bool left_pressed;
    bool right_pressed;
    int clickTimes;
};

#endif // MAINWINDOW_H
